package com.example.transport.message;


/***
 *
 * 监听消息回调响应
 */
public class CallBackReponse extends Response {


    public static class ResponseFuture {

        private String requestId;

        private Response response;

        private Object object = new Object();

        public Response getResponse() throws Exception {
            synchronized (object) {
                object.wait();
            }
            return this.response;
        }

        public void completeResponse(Response response) {
            synchronized (object) {
                this.response = response;
                object.notify();
            }
        }

        public String getRequestId() {
            return requestId;
        }

        public void setRequestId(String requestId) {
            this.requestId = requestId;
        }

        public void setResponse(Response response) {
            this.response = response;
        }

        public Object getObject() {
            return object;
        }

        public void setObject(Object object) {
            this.object = object;
        }

        public ResponseFuture() {
        }

        public ResponseFuture(String requestId) {
            this.requestId = requestId;
        }
    }
}
